/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package czStvDpds.network;

import czStvDpds.centrallogic.PlayerMovement;
import czStvDpds.logging.Logging;
import czStvDpds.movement.Player;
import java.awt.event.ActionListener;
import java.net.DatagramPacket;
import java.util.Scanner;
import java.util.logging.Level;
import czStvDpds.network.*;


/**
 *
 * @author Xide
 */
public class PacketMaker {
    private Sender s;
    public String zprava;    
    private DatagramPacket q;
    private PotvrzeniThread pt;
    
    public PacketMaker(Sender s, PotvrzeniThread pt) {
        this.s = s;
        this.pt = pt;
    }

    
    
    
    
    public void zpracujZero(String nick) {
        
        //pripojeni
        //ex.: 00--nick-id 
        Logging.getMainLogger().log(Level.SEVERE, "zpracovavam ZERO");
        zprava = "00-" + nick + "-";            
              
        q = new DatagramPacket(zprava.getBytes(), zprava.length(), s.addressOfServer, s.SENDING_PORT); 
        
        pt.setPacket(q);
        pt.start();
        
    }

       
    public void zpracujFirst(Double x, Double y, Double angle) {
        //pohyb
        //11-objekt-souradnice_X-souradnice_y-uhel_smeru
        Logging.getMainLogger().log(Level.SEVERE, "zpracovavam FIRST");
        
        zprava = "11-" + x + "-" + y + "-" + angle + "-";
        s.sendPacket(new DatagramPacket(zprava.getBytes(), zprava.length(), s.addressOfServer, s.SENDING_PORT));
    }

    public void zpracujSecond(Scanner scanner) {

        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void zpracujThird(Scanner scanner) {
        //ex.: 33-hrac_id-pocet_zivotu 
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void zpracujFourth(Scanner scanner) {
        //ex.: 44-zmena_na_x-zmena_na_y-zmeneno_na 
        throw new UnsupportedOperationException("Not supported yet.");
    }

    public void zpracujFifth(Scanner scanner) {
        //55-hrac_id                  
        throw new UnsupportedOperationException("Not supported yet.");
    }
}
